忍者ブログ
趣味+メモ用のブログです。 GNU/Linux関連、OSS関連情報、調査事項になるでしょうが、何を書くか分かりません。
[53] [52] [51] [50] [49] [48] [47] [46] [45] [44] [43]
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

Japanino(ArduinoISP) でTiny2313の焼きこみが出来ました。
(少し苦労しましたが・・・)

3a762cb5.jpeg




■ 参照ページ
・ArduinoISPを使う
http://www.geocities.co.jp/arduino_diecimila/use/attiny.html

■ 環境
・Debian GNU/Linux Sqweeze
・学研 Japanino
・ATTiny2313
・抵抗 100Ω x 2個ぐらい
・ブレッドボード(小さめでもOK)
・ブレッドボード用の線x9本ぐらい


■ 手順通りやってみる
手順通り実施してみた。

1)  hardware.zip/avrdude_conf.zipのセットアップ
・以下のダウンロード
hardware.zip
avrdude_conf.zip
・環境へ展開
$ unzip hardware.zip
$ unzip avrdude_conf.zip
$ cp avrdude.conf ~/Arduino/arduino-0022/hardware/tools/
$ cp -r hardware ~/Arduino/arduino-0022/

2) ArduinoISP 0.022(or0.021)を起動
$ cd ~/Arduino/arduino-0022
$ ./arduino&


3) Japaninoに、ArduinoISPをUpload
・[Tool]->[Board]->[Arduino Pro or Pro Mini ( 3.3V, 8MHz)  w/ ATmega168
・[File]->[Examples]->[ArduinoISP]
・[Upload] ボタン押下
→正常終了します。

4) Japanino + ATTiny2313を接続
JapaninoとATTiny2313を接続する。
Japaninoe側 ATTiny2313側
GND GND (pin10)
+5V VCC (pin20)
D13 SCK (pin19) ※1
D12 MISO (pin18)
D11 MOSI (pin17)
D10 RESET* (pin1)
※1 ※マルツサイトで落としたデータシートはSCLとなっているが、間違い?
※2 ※Arduino側のピンについては、ArduinoISPのスケッチのコメントに記述あり

5) LED点滅のスケッチを作成
ArduinoISPを使う」のサイトのスケッチをコピー
void setup( ) {
 
  pinMode(0, OUTPUT);
}

void loop( ) {
  digitalWrite(0, HIGH);
  delay(125);  /* 1MHzで1秒スリープになる */
  digitalWrite(0, LOW);
  delay(125);
}

6) Boardの設定(ATTiny2313)
[Tools]->[Board]->[ATTiny2313 / Int 8MHz]

9) スケッチのUpload
[Upload]ボタンを押下するが、以下のようにシグネチャ不一致でエラーとなる
Binary sketch size: 726 bytes (of a 2048 byte maximum)
Arduino/arduino-0022/hardware/tools/avrdude -CArduino/arduino-0022/hardware/tools/avrdude.conf -v -v -v -v -pattiny2313 -cstk500v1 -P/dev/ttyUSB0 -b19200 -Uflash:w:/tmp/build2246633317915171580.tmp/Blink1.cpp.hex:i 

avrdude: Version 5.4-arduino, compiled on Oct 22 2007 at 13:15:12
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "Arduino/arduino-0022/hardware/tools/avrdude.conf"
         User configuration file is ".avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port            : /dev/ttyUSB0
         Using Programmer      : stk500v1
         Overriding Baud Rate  : 19200
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
         AVR Part              : ATtiny2313
         Chip Erase delay      : 9000 us
         PAGEL                 : PD4
         BS2                   : PD6
         RESET disposition     : possible i/o
         RETRY pulse           : SCK
         serial program mode   : yes
         parallel program mode : yes
         Timeout               : 200
         StabDelay             : 100
         CmdexeDelay           : 25
         SyncLoops             : 32
         ByteDelay             : 0
         PollIndex             : 3
         PollValue             : 0x53
         Memory Detail         :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65     6     4    0 no        128    4      0  4000  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6    32    0 yes      2048   32     64  4500  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          2    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
avrdude: Send: A [41] . [80]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [02] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [81]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [01] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [82]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [98]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [03] 
avrdude: Recv: . [10] 
         Hardware Version: 2
         Firmware Version: 1.16
avrdude: Send: A [41] . [84]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [85]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [86]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [87]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [89]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: Send: A [41] . [81]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [01] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [82]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: Recv: . [10] 
avrdude: Send: B [42] # [23] . [00] . [00] . [01] . [01] . [01] . [01] . [03] . [ff] . [ff] . [ff] . [ff] . [00]   [20] . [00] . [80] . [00] . [00] . [08] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: Send: E [45] . [05] . [04] . [d4] . [d6] . [01]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: Send: P [50]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: AVR device initialized and ready to accept instructions

Reading | avrdude: Send: u [75]   [20] 
avrdude: Recv: . [14] . [1e] . [94] . [06] . [10] 
################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9406
avrdude: Expected signature for ATtiny2313 is 1E 91 0A
         Double check chip, or use -F to override this check.
avrdude: Send: Q [51]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 

avrdude done.  Thank you.
 


■ 調査
・Arduino0.021/0.022どちらで実施しても、上記のエラーメッセージが出る。
・[Device signature = 0x139f06]は、ATmega168、つまりJapanino側のシグネチャになる。
→つまり、ATTiny2313には書き込めていないことになる。
→いろいろWebを見ていると、0.021でも書き込み失敗し、オートリセットが掛かっている人もいる模様。
「ArduinoISPを使う」のサイト上の方の、オートリセットの対応について見てみることに。

■ オートリセット
Arduinoでは、ISPで焼き込む前に、自動でリセットしているようであるが、
ArduinoISPでは何らかの方法でオートリセットを停止している?
→しかし、私の環境では、HEXアップ時に、オートリセットがかかってしまっていた模様。

■ 対応
・DisablingAutoResetOnSerialConnection
http://www.arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection

上記サイトより、一番手っ取り早い方法を実施。
Japanino(Arduino)側の [RESET*]と[+5V]を120Ω抵抗で接続し、
強制的に、RESETを無効にする方法。
→120Ωは手持ちがなかったため、カーボン100Ωで代用

再度、LED点滅プログラムをUPしたところ、うまく動きました。

■ ATTiny2313を1MHz から、8MHzに変更
上記状態のまま、ArduinoIDEから以下を実行。
[Tool]->[Burn Bootloader]->[w/ Arduino as ISP]

LEDの点滅が8倍になる(delayがただしくなる)ことを確認


以上





PR


トラックバック
この記事にトラックバックする:


忍者ブログ [PR]
カレンダー
03 2024/04 05
S M T W T F S
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
フリーエリア
最新コメント
最新トラックバック
プロフィール
HN:
一乗寺 又兵衛
性別:
男性
職業:
コンパイル
趣味:
コンパイル
バーコード
ブログ内検索